package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.AdminQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.AdminDao;
import com.bbdjt.weixin.model.Admin;
import com.bbdjt.weixin.service.AdminService;

@Service("adminService")
public class AdminServiceImpl extends BaseServiceImpl<Admin> implements AdminService {
	
	@Override
    public List<Admin> selectByAdmin(Admin admin, int page, int rows) {
        Example example = new Example(Admin.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(admin);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Admin> selectByAdmin(Admin admin) {
        Example example = new Example(Admin.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(admin);
        return selectByExample(example);
    }

    @Override
    public PageInfo<AdminQueryModel> selectByAdminQueryModel(AdminQueryModel admin) {
    	return ((AdminDao) getMapper()).selectByAdminModel(admin);
    }

	@Override
	public List<Admin> selectByAdmin(AdminQueryModel admin) {
		  Example example = new Example(Admin.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(admin);
	        PageHelper.startPage(admin.getPageNum(), admin.getPageSize(),admin.getOrderBy());
	        return selectByExample(example);
	}

	
}